package leetcode;

/**
 * Created by baoyunfeng on 2019/8/4.
 *
 * https://leetcode.com/problems/longest-substring-without-repeating-characters/submissions/
 */
public class Longest_Substring_Without_Repeating_Characters {

    public static void main(String args[]) {
        lengthOfLongestSubstring("pwwkew");
    }

    public static String lengthOfLongestSubstring(String s) {
        int num[] = new int[s.length()];
        String maxStr = "";
        for (int i = 0; i < s.length(); i++) {
            String tempStr = "";
            for(int j = i; j < s.length();j++){
                if (tempStr.contains(s.charAt(j)+"")) {
                    break;
                }else{
                    tempStr += s.charAt(j);
                }
            }
            if(tempStr.length() > maxStr.length()){
                maxStr = tempStr;
            }
        }
        return maxStr;
    }
}
